#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <iostream>
#include <sstream>

#include "tests.h"
#include "../source/logger/Logger.h"

using namespace std;

int main( int argc, const char* argv[] ){
	std::stringstream output;	// Output string
	int testIndex = 1;		// Improves readability of text output

	bool doIntegrationTests = 0;
	
	if (argc > 1 && strcmp(argv[1], "robot") == 0 ) {
		doIntegrationTests = 1; 
	}

	if (doIntegrationTests) {
		output << "Test " << testIndex++ << ": test Servo";
		Logger::getInstance().log("*******************");
		Logger::getInstance().log(output.str());
		Logger::getInstance().log("*******************");
		startDrivingTest();
	}

	output.str("");
	output << "Test " << testIndex++ << ": test Logger";
	Logger::getInstance().log("");
	Logger::getInstance().log("*******************");
	Logger::getInstance().log(output.str());
	Logger::getInstance().log("*******************");
	testLogger();

	output.str("");
	output << "Test " << testIndex++ << ": test UDP Receiver";
	Logger::getInstance().log("");
	Logger::getInstance().log("*******************");
	Logger::getInstance().log(output.str());
	Logger::getInstance().log("*******************");
	testUDPReceiver();
		
	cout << endl << endl << "Ending robot testing\n";
	return 0;
}

bool testVoorbeeld() {
	int actual = 2 + 3;
	int expected = 5;
	return actual == expected;
}
